from datetime import datetime

from ext import db


class Desen(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    # 任务名称
    mission_name = db.Column(db.String(100), nullable=False)
    # excel文件名和路径
    excel_name = db.Column(db.String(100), nullable=False)
    excel_loc = db.Column(db.String(100))
    # 建表文件名称和路径
    create_sql_name = db.Column(db.String(100), nullable=False)
    create_sql_loc = db.Column(db.String(100))
    # 脱敏文件名称和路径
    insert_sql_name = db.Column(db.String(100), nullable=False)
    insert_sql_loc = db.Column(db.String(100), nullable=False)
    # 错误日志文件名称和路径
    error_sql_name = db.Column(db.String(100), default='无文件')
    error_sql_loc = db.Column(db.String(100), default='无文件')
    insert_time = db.Column(db.DateTime, default=datetime.now)

    def __str__(self):
        return self.mission_name
